﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace Management.Core
{
    /// <summary>
    /// 管理员模型
    /// </summary>
    public class Admin
    {
        [Key]
        public int AdminID { get; set; }

        /// <summary>
        /// 帐号
        /// </summary>
        [Required(ErrorMessage = "必须输入{0}")]
        [StringLength(30, MinimumLength = 4, ErrorMessage = "{0}长度为{2}-{1}个字符")]
        [Display(Name = "帐号")]
        public string Accounts { get; set; }

        ///// <summary>
        ///// 角色
        ///// </summary>
        //public int AdminRoleID { get; set; }
        
        /// <summary>
        /// 密码
        /// </summary>
        [DataType(DataType.Password)]
        [Required(ErrorMessage = "必须输入{0}")]
        [StringLength(256, ErrorMessage = "{0}长度少于{1}个字符")]
        [Display(Name = "密码")]
        public string Password { get; set; }

        /// <summary>
        /// 头像ID
        /// </summary>
        [Display(Name = "头像ID")]        
        public int PictureID { get; set; }

        /// <summary>
        /// email
        /// </summary>
        [Display(Name = "Email")]
        public string Email { get; set; }

        /// <summary>
        /// 联系方式
        /// </summary>
        [Display(Name = "联系方式")]
        public string Phone { get; set; }

        /// <summary>
        /// 登录IP
        /// </summary>
        [Display(Name = "登录IP")]
        public string LoginIP { get; set; }

        /// <summary>
        /// 登录时间
        /// </summary>
        [Display(Name = "登录时间")]
        public Nullable<DateTime> LoginTime { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        [Display(Name = "创建时间")]
        public DateTime CreateTime { get; set; }

        //public virtual AdminRole.AdminRole AdminRole { get; set; }
        public virtual ICollection<AdminRole.AdminRole> AdminRole { get; set; }

        public virtual Picture.Picture Picture { get; set; }
    }
}
